import { FormSchema } from '/@/components/Table';
import { render } from '/@/utils/common/renderUtils';
export const columns = [
  {
    title: '字段名称',
    dataIndex: 'extractFieldName',
    width: 150,
  },
  {
    title: '提示内容',
    dataIndex: 'promptContent',
    width: 300,
  },
  {
    title: '是否标准',
    dataIndex: 'isStandard',
    width: 100,
    sorter: true,
    customRender: ({ text }) => {
      return render.renderDict(text, 'isStandard');
    },
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 300,
  },
];
export const searchFormSchema: FormSchema[] = [
  {
    field: 'extractFieldName',
    label: '字段名称',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    field: 'promptContent',
    label: '提示内容',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: '是否标准',
    field: 'isStandard',
    component: 'JDictSelectTag',
    componentProps: {
      dictCode: 'isStandard',
      placeholder: '请选择标准',
      stringToNumber: true,
    },
    colProps: { span: 6 },
  },
];
/**
 * 角色用户搜索form
 */
export const searchUserFormSchema: FormSchema[] = [
  {
    field: 'username',
    label: '用户账号',
    component: 'Input',
    colProps: { span: 12 },
    labelWidth: 74,
  },
];

export const formSchema: FormSchema[] = [
  {
    field: 'id',
    label: '',
    component: 'Input',
    show: false,
  },
  {
    field: 'extractFieldName',
    label: '字段名称',
    required: true,
    component: 'Input',
  },
  {
    label: '提示内容',
    field: 'promptContent',
    required: true,
    component: 'InputTextArea',
  },
  {
    label: '标准',
    field: 'isStandard',
    component: 'RadioGroup',
    defaultValue: 1,
    componentProps: () => {
      return {
        options: [
          { label: '标准', value: 1, key: '1' },
          { label: '非标准', value: 0, key: '0' },
        ],
      };
    },
  },
];

export const formDescSchema = [
  {
    field: 'roleName',
    label: '角色名称',
  },
  {
    field: 'roleCode',
    label: '角色编码',
  },
  {
    label: '备注',
    field: 'description',
  },
];

export const modelFormSchema: FormSchema[] = [
  {
    label: 'APIkey',
    field: 'apiKey',
    component: 'Input',
    required: true,
    helpMessage: '请输入APIkey',
  },
];